import { ApiProperty } from '@midwayjs/swagger';
import { Rule, RuleType } from '@midwayjs/validate';
import { Column, PrimaryGeneratedColumn, Entity } from 'typeorm';
@Entity({
  name: 'Account',
  synchronize: false,
})
export class Account {
  @ApiProperty({ example: 0 })
  @Rule(RuleType.number().required())
  @PrimaryGeneratedColumn()
  accountId: number;
  @ApiProperty({ example: 'zhangjiu001' })
  @Rule(RuleType.string().required())
  @Column()
  username: string;
  @ApiProperty({ example: '123456' })
  @Rule(RuleType.string().required())
  @Column()
  password: string;
  @ApiProperty({ example: true })
  @Rule(RuleType.boolean().required())
  @Column({ default: true })
  enabled: boolean;
  @ApiProperty({ example: null })
  @Rule(RuleType.date().allow(null).required())
  @Column({ nullable: true })
  lastLoginTime: Date;
  @ApiProperty({ example: '张九' })
  @Rule(RuleType.string().required())
  @Column()
  nickname: string;
}
